﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

namespace download
{
    /// <summary>
    /// Handler 的摘要说明
    /// </summary>
    public class Handler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            HttpResponse Response = context.Response;
            string fileName = ConfigurationManager.AppSettings["filename"];
            string filePath = context.Server.MapPath(ConfigurationManager.AppSettings["filename"]);//路径

            Response.ContentType = "application/x-zip-compressed";
            Response.AddHeader("Content-Disposition", "attachment;filename="+ ConfigurationManager.AppSettings["filename"]);
            string filename = context.Server.MapPath(fileName);
            Response.TransmitFile(filename);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}